﻿
using System.Collections.Generic;

namespace IDEAMS.model.dataAcquisition
{
    public class CollectData
    {
        public string name {  get; set; }
        public int channelNo {  get; set; }
        public int gratingNo { get; set; }
        public double maxValue { get; set; }
        public double minValue { get; set; }
        public double avgValue { get; set; }

        public int count { get; set; }

        public List<double> values { get; set; }

        public double sum { get; set; }

        public CollectData()
        {
            values = new List<double>();
        }

        public CollectData(CollectData data)
        {
            Copy(data);
        }

        public CollectData(CollectDataViewModel data)
        {
            Copy(data);
        }

        public void Copy(CollectData data)
        {
            this.name = data.name;
            this.channelNo = data.channelNo;
            this.gratingNo = data.gratingNo;
            this.maxValue = data.maxValue;
            this.minValue = data.minValue;
            this.avgValue = data.avgValue;
            values = new List<double>();
            foreach (var item in data.values)
            {
                values.Add(item);
            }
        }

        public void Copy(CollectDataViewModel data)
        {
            this.name = data.name;
            this.channelNo = data.channelNo;
            this.gratingNo = data.gratingNo;
            this.maxValue = data.maxValue;
            this.minValue = data.minValue;
            this.avgValue = data.avgValue;
            values = new List<double>();
            foreach (var item in data.values)
            {
                values.Add(item);
            }
        }

        public CollectData Clone()
        {
            return new CollectData(this);
        } 
    }
}
